<template>
  <el-dialog v-model="dialogFormVisible" title="添加sku" width="500">
    <el-form :model="form">
      <el-form-item label="名称" :label-width="formLabelWidth">
        <el-input v-model="form.name" placeholder="请输入sku名称"/>
      </el-form-item>
      <el-form-item label="数量" :label-width="formLabelWidth">
        <el-input v-model="form.price" placeholder="请输入sku数量" />
      </el-form-item>
      <el-form-item label="价格" :label-width="formLabelWidth">
        <el-input v-model="form.num" placeholder="请输入sku价格" />
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
         <el-button type="primary" @click="dialogFormVisible = false">
          立即添加
        </el-button>
        <el-button @click="dialogFormVisible = false">取消</el-button>
      </div>
    </template>
  </el-dialog>
</template>

<script lang="ts" setup>
import { reactive, ref } from 'vue'

const dialogFormVisible = ref(false)
const formLabelWidth = '140px'

const form = reactive({
  name: '',
  price:"",
  num:""
})

// 暴露显示弹窗的方法
const showFormDialog = () => {
  dialogFormVisible.value = true
}

defineExpose({
  showFormDialog
})
</script>
